<?php if (isset($data['chi_tiet'])) { ?>
  <div id="nhap-gia-title">Nhập giá cho phiếu vật tư <?php echo $data['phieu']->ma_phieu ?></div>
  <form method="post" action="<?php echo base_path() . 'san_pham/phieu_xuat_nhap/nhap_gia/' . $data['type'] . '/' . $data['phieu']->ma_phieu ?>" id="nhap-gia-vat-tu" class="<?php echo $data['type'] ?>">
<!--    <div class="form-item form-select-wrapper nha-cung-cap-wrapper">-->
<!--      <label>Nhà cung cấp:</label>-->
<!--      <label class="data-text tncc-data-text">--><?php //echo $data['phieu']->ref . '[' . $data['phieu']->ma_ref . ']' ?><!--</label>-->
<!--      <label>Số nợ:</label>-->
<!--      <label class="data-text nncc-data-text" id="tien-no-ncc">--><?php //echo $data['phieu']->tien_no ?><!--</label>-->
<!--      <div class="clear"></div>-->
<!--    </div>-->
<!--    <div class="clear"></div>-->
    <fieldset>
      <legend>Vật tư</legend>
      <div id="form-item-wrapper">
        <?php foreach ($data['chi_tiet'] as $vat_tu) { ?>
          <div class="form-item-row">
            <div class="form-item form-text-wrapper">
              <label>Tên sản phẩm:</label>
              <label class="data-text tvt-data-text"><?php echo $vat_tu->ten_thanh_pham . ' [' . $vat_tu->ma_thanh_pham . ']' ?></label>
            </div>
            <div class="form-item form-text-wrapper">
              <label>Số lượng:</label>
              <label class="data-text sl-data-text"><?php echo $vat_tu->so_luong ?></label>
            </div>
            <div class="form-item form-text-wrapper">
              <label for="txt-gia-tien-<?php echo $vat_tu->id ?>">Giá tiền</label>
              <input id="txt-gia-tien-<?php echo $vat_tu->id ?>" value="<?php echo ($_POST) ? $_POST['gia_tien'][$vat_tu->id] : number_format($vat_tu->gia_tien) ?>" name="gia_tien[<?php echo $vat_tu->id ?>_<?php echo $vat_tu->so_luong ?>]"
                     type="text"
                     class="form-text text txt-gia-tien <?php echo (isset($_POST['error']['gia_tien']) && $_POST['error']['key'] == $vat_tu->id)
                       ? 'error' : '' ?>" autocomplete="OFF"/>
            </div>
            <div class="clear"></div>
          </div>
        <?php } ?>
      </div>
    </fieldset>
    <div class="form-item form-textarea-wrapper">
      <label for="ghi-chu">Ghi chú</label>
      <textarea id="ghi-chu" name="ghi_chu"
                class="form-textarea <?php echo ($_POST && (string) $_POST['error']['key'] == 'ghi_chu') ? 'error'
                  : '' ?>" cols="60" rows="5"><?php echo ($_POST) ? $_POST['ghi_chu'] : $data['phieu']->ghi_chu ?></textarea>

      <div class="description">Nhập tối đa 500 ký tự. Số lượng hiện thời: <span style="color: red;"
                                                                                id="ghi-chu-length">0</span></div>
    </div>
    <div id="submit-wrapper">
      <input id="submit" type="submit" onclick="return check_nhap_gia();" value="Nhập giá" class="form-submit"/>
    </div>
  </form>
<?php } ?>